<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			//全局
			var name = "张三"; //全局变量
			// var sex = "男";

			function fn() {
				//局部
				var age = 20;
				console.log(age); //局部变量
				var name = "李四";
				console.log(name); //李四
				console.log(sex); //男
			}
			fn();
			console.log(name); //张三
			// console.log(age);
			// fn();
		</script>
	</head>
	<body>
	</body>
</html>
